//
//  CasesShowCollectionViewCell.m
//  customer
//
//  Created by Holothurian on 2018/10/29.
//  Copyright © 2018年 yinlong. All rights reserved.
//

#import "CasesShowCollectionViewCell.h"

@interface CasesShowCollectionViewCell ()



@end


@implementation CasesShowCollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        _imgView = [[UIImageView alloc]init];
        _imgView.contentMode = UIViewContentModeScaleAspectFill;
        _imgView.layer.cornerRadius = 15;
        _imgView.layer.masksToBounds = YES;
        [self.contentView addSubview:_imgView];
        AutoWeakSelf
        [_imgView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.edges.equalTo(weakSelf.contentView);
        }];
        
        
        self.effectView = [[UIView alloc]init];
        self.effectView.backgroundColor = [UIColor lightGrayColor];
        self.effectView.alpha = 0.7;
        self.effectView.layer.cornerRadius = 15;
        self.effectView.layer.masksToBounds = YES;
        [self.contentView addSubview:self.effectView];
        [self.effectView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.edges.equalTo(weakSelf.contentView);
        }];
        
        _titlelabel = [[UILabel alloc]init];
        _titlelabel.textColor = [UIColor whiteColor];
        _titlelabel.font = Font(20);
        _titlelabel.textAlignment = NSTextAlignmentCenter;
        [self.contentView addSubview:_titlelabel];
        [_titlelabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.center.equalTo(weakSelf.contentView);
            make.width.equalTo(weakSelf.contentView);
            make.height.mas_equalTo(30);
        }];
    }
    return self;
}

- (void)cellForLayout:(CasesShowModel *)model{
    [self.imgView sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",kCustomerImageIP,model.effect_img]] placeholderImage:[UIImage imageNamed:@"globalPlaceholder"]];
    self.titlelabel.text = model.effect_name;
}


- (void)cellForRepairLayout:(SelectRepairModel *)model{
    [self.imgView sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",kCustomerImageIP,model.parts_img]] placeholderImage:[UIImage imageNamed:@"globalPlaceholder"]];
    self.titlelabel.text = model.parts_name;
}

- (void)cellForBaseLayout:(CasesShowBaseModel *)model WithIndexPath:(nonnull NSIndexPath *)indexPath{
    [self.imgView sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",kCustomerImageIP,model.effect_img]] placeholderImage:[UIImage imageNamed:@"globalPlaceholder"]];
}


@end
